package com.lipp.luosu.dto;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.io.File;

/**
 * @ClassNameTestDemo
 * @description: TODO 类描述
 * @Author lipp
 * @Date 2024/2/4 15:50
 * @Version 1.0
 */
public class TestDemo {
    public static void main(String[] args) {
        // 设置Firefox浏览器驱动程序路径
        System.setProperty("webdriver.gecko.driver", "E://main/msedgedriver.exe");

        // 创建一个Firefox浏览器实例
        WebDriver driver = new EdgeDriver();

        // 访问一个Web页面
        driver.get("https://www.htxxpx.com/classModule/video/478977/478344/1879161/0/0");
        JavascriptExecutor js = (JavascriptExecutor) driver;
        // 执行JavaScript代码
        String javascriptCode = "    updateStatus(3)\n" + "    tailVideoOverGoto()";
        js.executeScript(javascriptCode);

        // 等待用户按键
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        // 关闭浏览器
        driver.quit();
    }
}
